package math

func numWaterBottles(numBottles int, numExchange int) int {
	have := numBottles
	res := 0

	for have >= numExchange {
		res += have / numExchange * numExchange
		have = have/numExchange + have%numExchange
	}

	res += have
	return res

}
